#include <iostream>
#include "table_aux.h"
#include <string>
// aixó és una puta merda
using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    cout << "Hello, World!\n";
	cout << "Process to insert new identifiers\n";
	char name[255];
	values val;
	simbols_table * table;
	table=new simbols_table;
	
	for(int i=1; i<20; i++)
	{
		sprintf(name,"ID%d", i);
		val.INT_=i;
		cout << "Adding identifier: "<< name << endl;
		
		table->insert(name,val,INT);
		
	}
	//try find id 15
	cout << "Verifing added" <<endl;
	for (int i= -5; i< 25; i++)
	{
		sprintf(name,"ID%d", i);

		if(table->exist(name) )
			cout << "SI existe el "<< name << endl;
	
		else
			cout << "NO existe el "<< name << endl;
	}
	
	
	delete (table);
	
	table=new simbols_table;

	while(true)
	{
		int i;
		cout << "Procedimiento manual: " << endl;
		cout << "Introduzca un número para el identificador" << endl;
		cout << "Introduzca 0 para finalizar" << endl;
		cin >> i;
		if(!i) break;
		
		sprintf(name,"ID%d", i);
		val.INT_=i;
		cout << "Adding identifier: "<< name << endl;
		
		if(1!=table->insert(name,val,INT))
			cout << "error insertando" << endl;
		
		
	}
	
	cout << "mostramos todo" << endl;
	table->show_table();
	
	delete(table);
	
	
	
	
    return 0;
}
